-- null_ls 自定义分析诊断
local null_ls = require("null-ls")
local no_really = {
  method = null_ls.methods.DIAGNOSTICS,
  filetypes = { "go", "markdown", "text" },
  generator = {
    fn = function(params)
      local diagnostics = {}
      for i, line in ipairs(params.content) do
        local col, end_col = line:find("really")
        if col and end_col then
          table.insert(diagnostics, {
            row = i,
            col = col,
            end_col = end_col + 1,
            source = "no-really",
            message = "禁止使用 'really'!",
            severity = vim.diagnostic.severity.WARN,
          })
        end
      end
      return diagnostics
    end,
  },
}

null_ls.register(no_really)
